<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>改变网页背景色</title>
</head>
<body>
    <script>
        function color(str){
            document.body.style.backgroundColor=str;
        }
    </script>
    <input type="button" value="设置绿色" onclick="color('green')">
    <input type="button" value="设置黄色" onclick="color('yellow')">
    <input type="button" value="设置蓝色" onclick="color('blue')">
    <input type="button" value="设置自定义颜色" onclick="color('#00ff00')">

</body>
</html>